package com.example.interview.no0101.solution;

import com.example.interview.no0101.Solution;

import java.util.HashSet;
import java.util.Set;

/**
 * @Description 解答-判定字符是否唯一
 * @ClassName SolutionImpl
 * @Author Administrator
 * @Date 2020/5/20 10:26
 * @Version 1.0.0
 */
public class SetSolutionImpl implements Solution {

    @Override
    public boolean isUnique(String str) {
        char[] chars = str.toCharArray();
        Set set = new HashSet();
        for (char c: chars) {
            set.add(c);
        }
        if(set.size() == chars.length){
            return true;
        }
        return false;
    }
}
